<template>
  <div class="app">
    <h2>我是祖组件--{{name}}只需{{price}}</h2>
    <Child :car="car"></Child>
  </div>
</template>

<script>
import Child from './components/child.vue'
import {reactive, provide, toRefs} from 'vue'
export default {
  name: 'App',
  components: {
    Child
  },
  setup(){
    let car = reactive({name:'奔驰',price:'40W'})
    provide('car',car) //给自己的后代组件传递数据
    return {...toRefs(car), car}
  }

}
</script>

<style>
.app{
  background-color: aqua;
  padding: 10px;
}
</style>
